package com.alibaba.nacos.common.remote.client.grpc;

import com.alibaba.nacos.common.remote.client.ServerListFactory;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@DependsOn(value = "grpcClusterServer")
public class GrpcClusterClient
        extends GrpcClient {

    public GrpcClusterClient() {
        setServerListFactory(new ServerListFactory() {
            @Override
            public String genNextServer() {
                return "127.0.0.1:8858";
            }

            @Override
            public String getCurrentServer() {
                return "127.0.0.1:8858";
            }

            @Override
            public List<String> getServerList() {
                return List.of("127.0.0.1:8858");
            }
        });
        start();
    }

    @Override
    public int rpcPortOffset() {
        return 1001;
    }
}
